{extend name="public:base" /}

{block name="body"}

    {include file="channel/_bread" title="评论详情" /}

    <div id="page-wrapper" class="container-fluid">
        <div class="page-header">查看评论</div>
        <div class="page-content">
            <form method="post" action="{:url('channel/commentview',['id'=>$model['id']])}">
                <div class="form-group">
                    <div>
                        <img src="{$member.avatar}" width="40" height="40" class="rounded-circle size4" /> {$model.nickname} 在 <a href="{:url('index/channel/view',['channel_name'=>$channel['name'],'cate_name'=>$category['name'],'id'=>$article['name']])}" target="_blank">{$article.title}</a> 的评论&nbsp;&nbsp;<span class="text-muted">{$model.create_time|showdate}</span>
                    </div>
                </div>
                <div class="form-group">
                    <label for="bb">评论内容</label>
                    <div class="form-control">{$model.content}</div>
                </div>
                <div class="form-group actions">
                    {if $model['status'] == 0}
                        <a href="{:url('channel/commentstatus',['id'=>$model['id'],'status'=>1])}" data-confirm="确定审核此评论？" class="btn btn-success">审核</a>
                    {/if}
                    {if $model['status'] == 2}
                        <a href="{:url('channel/commentstatus',['id'=>$model['id'],'status'=>2])}" data-confirm="确定显示此评论？" class="btn btn-info">显示</a>
                        {else/}
                        <a href="{:url('channel/commentstatus',['id'=>$model['id'],'status'=>2])}" data-confirm="确定隐藏此评论？" class="btn btn-info">隐藏</a>
                    {/if}
                    <a href="{:url('channel/commentdelete',['id'=>$model['id']])}" data-confirm="确定删除此评论？" class="btn btn-danger">删除</a>
                </div>
                {volist name="replies" id="reply"}
                <div class="form-group">
                    <label for="bb">{$reply.nickname}</label>
                    <div class="form-control">{$reply.content}</div>
                </div>
                {/volist}
                <div class="form-group">
                    <label for="cc">回复内容</label>
                    <textarea class="form-control" name="content" cols="30" rows="5"></textarea>
                </div>
                <div class="form-group">
                    <input type="hidden" name="reply_id" value="{$model.id}">
                    <input type="hidden" name="channel_id" value="{$channel.id}">
                    <button type="submit" class="btn btn-primary">回复</button>
                </div>
            </form>
        </div>
    </div>
{/block}
{block name="script"}
    <script type="text/javascript">
        jQuery(function ($) {
            $('.actions a').click(function (e) {
                e.preventDefault();
                e.stopPropagation();
                var url=$(this).attr('href');
                dialog.confirm($(this).data('confirm'),function () {
                    $.ajax({
                        url:url,
                        dataType:'JSON',
                        success:function (json) {
                            dialog.alert(json.msg,function () {
                                if(json.code==1){
                                    location.reload();
                                }
                            });
                        }
                    })
                })
            })
        })
    </script>
{/block}